#include <iostream>
#include<sys/time.h>
#include<unistd.h>
using namespace std;
int* a, * b;
const int n = 300000;//规定是偶数，方便二路算法计算
int main()
{
    a = new int [n];
    b = new int[n];
    //初始化记录数据的数组
    for (int i = 0; i < n; i++)
    {
        a[i] = rand() % 100;
        b[i] = a[i];
    }

    //普通算法
    int solution1 = 0;
    struct timeval start1;
    struct timeval end1;
    gettimeofday(&start1, NULL);
    for (int i = 0; i < n; i++)
        solution1 += a[i];
    gettimeofday(&end1, NULL);
    cout << "普通算法耗时: " << end1.tv_sec - start1.tv_sec << "ms" << endl;
}